﻿#region Imports
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
#endregion

namespace DirectoryAnalyzer.Controls.Converters
{
    public class ExpanderColourConverter : IValueConverter
    {
        #region Converter Methods
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool source = (bool)value;
            string param = (string)parameter;

            switch (param)
            {
                case "Color":
                    switch (source)
                    {
                        case true:
                            return Colors.Green;
                        case false:
                        default:
                            return Colors.Red;
                    }

                case "Brush":
                    switch (source)
                    {
                        case true:
                            return Brushes.Green;
                        case false:
                        default:
                            return Brushes.Red;
                    }

                default:
                    throw new InvalidOperationException();
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
        #endregion
    }
}
